package com.heima.article.config.xxl_job;


import com.heima.article.service.ApArticleService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Log4j2
public class ComputHotArticle {

 @Autowired
    ApArticleService articleService;
    /**
     * 每天0点执行一次
     * @param param
     * @return
     * @throws Exception
     */
    @XxlJob("abcdefg") //@XxlJob("abcdefg")`这个一定要与调度中心新建任务的JobHandler的值保持一致
    public ReturnT<String> hello(String param) throws Exception {
        System.out.println("热门计算文章调度任务开始执行....");
        log.info("热门计算文章调度任务开始执行....");


        articleService.computeHotArticle();

        System.out.println("热门计算文章审核调度任务执行结束....");
        log.info("热门计算文章审核调度任务执行结束....");
        return ReturnT.SUCCESS;
    }

}